package com.example.demo.service.impl;

import com.example.demo.service.MyProcessInstanceService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: njz
 * @Description:
 * @Date: create in 2022/2/18 17:10
 */
@Service
public class MyProcessInstanceServiceImpl implements MyProcessInstanceService {
    @Autowired
    private RuntimeService runtimeService;

    @Override
    public ProcessInstance startProcessInstanceById(String id) {
        ProcessInstance processInstance = runtimeService.startProcessInstanceById(id);
        return processInstance;
    }

    @Override
    public ProcessInstance startProcessInstanceByKey(String key) {
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(key);
        return processInstance;
    }

    @Override
    public void deleteProcessInstance(String id, String reason) {
        runtimeService.deleteProcessInstance(id,reason);
    }
}
